<?php
print(print_r($_GET)."</br>");

// Set up the database connection
print("Connecting to DB...</br>");
$con = mysql_connect("localhost","root","");
if (!$con) {
	die('Could not connect: ' . mysql_error());
}
mysql_select_db("jabu_hello_world", $con);

$id=$_GET['id'];

//Read preson record from database.
$person = mysql_query("SELECT * FROM Persons WHERE P_Id=".$id);
$row = mysql_fetch_array($person);

// Close the DB connection.
mysql_close($con);	

?>

<html>
	<head>
		<title>Edit person</title>
	</head>
	<body>
		<form action="person-handler.php">
			id: <input name="id" type="text" value="<?php echo $row['P_Id'] ?>"/></br>
			name: <input name="name" type="text" value="<?php echo $row['FirstName'] ?>"/></br>
			surname: <input name="surname" type="text" value="<?php echo $row['LastName'] ?>"/></br>
			address: <input name="address" type="text" value="<?php echo $row['Address'] ?>"/></br>
			city: <input name="city" type="text" value="<?php echo $row['City'] ?>"/></br>
			<input name="action" value="update" type="hidden"/>
			<input type="submit" value="Update"/></br>
		</form>
	</body>
</html>